import gtk

global chat_list

def search(username):
	global chat_list
	
	for chat in chat_list:
		if chat.username == username: return chat
		
	return None

def append(chat_window):
	global chat_list
	
	chat_list.append(chat_window)

def remove(username):
	global chat_list
	
	win = search(username)
	
	chat_list.remove(win)

def remove_all():
	global chat_list
	
	for chat in chat_list:
		chat._obj.event(gtk.gdk.Event(gtk.gdk.DELETE))
